<template>
  <view>
    <!-- components/tohome/tohome.wxml -->
    <movable-area class="home-area">
      <movable-view direction="all" class="home-mview" :x="x" :y="y" @tap.stop.prevent="home">
        <text class="iconfont icon-shouye_shixin home-icon"></text>
      </movable-view>
    </movable-area>
  </view>
</template>

<script>
  // components/tohome/tohome.js
  let {
    windowWidth,
    windowHeight
  } = uni.getSystemInfoSync();
  let base = windowWidth / 750;
  export default {
    data() {
      return {
        x: base * (750 - 120),
        y: windowHeight - 340 * base
      };
    },
    /**
     * 组件的属性列表
     */
    props: {},
    /**
     * 组件的方法列表
     */
    methods: {
      home() {
        console.log('go home!');
        uni.switchTab({
          url: '/pages/index/index'
        });
      }
    }
  };
</script>
<style>
   .home-area {
    position: fixed;
    width: 100%;
    height: 100%;
    right: 0;
    bottom: 0;
    z-index: 100;
    pointer-events: none;
  }

  .home-mview {
    display: block;
    width: 100rpx;
    height: 100rpx;
    line-height: 100rpx;
    border-radius: 50%;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.7);
    pointer-events: auto;
  }

  .home-icon {
    font-size: 40rpx !important;
    color: #666;
  }
</style>
